<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
    <style>
        .grandParent{
            width: 300px;
            height: 300px;
            background-color:blueviolet;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .parent{
            width: 200px;
            height: 200px;
            background-color:tomato;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .child{
            width: 100px;
            height: 100px;
            background-color:springgreen;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
    </style>
</head>
<body>
    <div id="root">
        <div class="grandParent" @click.self="handleClickGrandParent">
            <div class="parent" @click.self="handleClickParent">
                <div class="child" @click="handleClickChild"></div>
            </div>
        </div>

        <div>
            <a href="http://www.woniuxy.com" @click.prevent="go">蜗牛学苑</a>
        </div>
        
    </div>
    <script>
        new Vue({
            el:'#root',
            methods: {
                handleClickGrandParent(e){
                    console.log('-----GrandParent-------');
                },
                handleClickParent(e){
                    console.log('-----parent-------');
                },
                handleClickChild(e){
                    console.log('-----child-------');
                    //e.stopPropagation();//使用原生的方式来完成事件冒泡的阻止
                },
                go(e){
                    //e.preventDefault()
                    let flg=window.confirm('您确认要进入吗？')
                    if(flg){
                        location="http://www.zhaijizhe.cn"
                    }
                }
            },
        })
    </script>
</body>
</html>